package com.zxy.demo.java.enumdemo;

/**
 * Seanson3.
 *
 * Created by zxybird on 17/1/23.
 */
public class Seanson3 {

  private Seanson3(String s) {
    m_ordinal = m_nextOrdinal++;
    m_name = s;
  }

  public String toString() {
    return m_name;
  }

  public String Name() {
    return m_name;
  }

  public int compareTo(Object obj) {
    return m_ordinal - ((Seanson3) obj).m_ordinal;
  }

  public static Seanson3[] values() {
    return m_seasons;
  }

  public static Seanson3 valueOf(String s) {
    for (Seanson3 m_season : m_seasons)
      if (m_season.Name().equals(s))
        return m_season;
    throw new IllegalArgumentException(s);
  }

  private final String m_name;
  private static int m_nextOrdinal = 0;

  private final int m_ordinal;
  public static final Seanson3 SPRING;
  public static final Seanson3 SUMMER;
  public static final Seanson3 FALL;
  public static final Seanson3 WINTER;
  private static final Seanson3 m_seasons[];

  static {
    SPRING = new Seanson3("Spring");
    SUMMER = new Seanson3("Summer");
    FALL = new Seanson3("Fall");
    WINTER = new Seanson3("Winter");
    m_seasons = (new Seanson3[] { SPRING, SUMMER, FALL, WINTER });
  }
}
